﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Services;

using SF.Base.Core;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using System.Web.SessionState;

namespace SF.Dict.Web.Submit
{
	/// <summary>
	/// 用户登录处理类
	/// </summary>
	[WebService(Namespace = "http://tempuri.org/")]
	[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
	public class login : IHttpHandler, IRequiresSessionState
	{

		public void ProcessRequest(HttpContext context)
		{
			context.Response.ContentType = "text/plain";

            //string json = context.Request.GetStream();
            //Logger.Detail(json);

            //JsonSerializer js = new JsonSerializer();

            //LJ_USER entity = null;
            //try
            //{
            //    entity = (LJ_USER)js.Deserialize(JObject.Parse(json).CreateReader(), typeof(LJ_USER));
            //    LJ_USER ret = BR.LJ_USER_LOGIN(entity.NAME, entity.PASSWORD);

            //    if (ret == null)
            //    {
            //        context.Response.Write("-1");	//用户名或密码错误
            //        return;
            //    }

            //    Global.LJUser = ret;

            //}
            //catch (System.Exception e)
            //{
            //    Logger.Exception("登录异常",e);
            //    context.Response.Write("-2");	//用户名或密码错误
            //}
		}

		public bool IsReusable
		{
			get
			{
				return false;
			}
		}
	}
}
